#include<stdio.h>
#include<stdlib.h>
#include "sdf.h"
int main(){
   void **pdh;
   pdh = (void **)malloc(20);
   int ret;
   ret = SDF_OpenDevice(pdh);
   if(ret != SDR_OK)
   {
       printf("打开设备失败! \n");
   }
   else
   {
       printf("成功打开设备！\n");
     }
   printf("查看设备信息\n");
   DEVICEINFO a;
   ret = SDF_GetDeviceInfo(*pdh,&a);
   if(ret !=SDR_OK)
           printf("查看设备信息失败！\n");
   else
           printf("查看设备信息成功！\n");
   printf("设备名称：%s\n",a.DeviceName);
   printf("设备版本号为%d\n",a.DeviceVersion);
   printf("请输入随机数长度：\n");
   int n;
   scanf("%d",&n);
   char string[100];
   ret = SDF_GenerateRandom(*pdh,n,string);
   if(ret !=SDR_OK)
       printf("生成随机数失败！");
    else
        printf("生成的随机数为%s\n",string);
   ret = SDF_CloseDevice(*pdh);
   
if(ret != SDR_OK)
   {
       printf("关闭设备失败！\n");
   }
   else
   {
       printf("成功关闭设备！\n");
   }


}